<!DOCTYPE html>
<html lang="en">

<head>
    <title>新增巡检任务</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="../css/global.css" rel="stylesheet">
    <link rel="stylesheet" href="../css/iconfont/iconfont.css">
    <link rel="stylesheet" href="../css/addPatrolPage.css">
    <script src="../js/vue.js"></script>
    <script src="../js/axios.js"></script>
    <link rel="stylesheet" href="../css/nutui/dist/nutui.css">
    <script src="../css/nutui/dist/nutui.js"></script>
</head>

<body>
    <div id="app">
        <div class="app_header">
            <div class="app_headerLeft" @click="back">
                <span class="iconfont icon-arrow-left-bold"></span>
            </div>
            <div class="app_headerTitle">新增巡检任务</div>
        </div>
        <div class="app_main">
            <div class="app_mainItem">
                <div class="app_mainItem_label">任务名称<span>*</span></div>
                <div class="app_mainItem_inp">
                    <input type="text" v-model="form.taskName" placeholder="请输入">
                </div>
            </div>
            <div class="app_mainItem">
                <div class="app_mainItem_label">巡检范围<span>*</span></div>
                <div class="app_mainItem_inp" @click="rangeShow = true">
                    <div :style="{color:form.range == '' ?'#D1D1D1':'#000'}">{{ form.range || '请选择'
                        }}<span class="iconfont icon-arrow-right-bold"></span></div>
                </div>
            </div>
            <div class="app_mainItem">
                <div class="app_mainItem_label">巡检内容<span>*</span></div>
                <div class="app_mainItem_inp" @click="contentShow = true">
                    <div :style="{color:form.content == '' ?'#D1D1D1':'#000'}">{{ form.content || '请选择'
                        }}<span class="iconfont icon-arrow-right-bold"></span></div>
                </div>
            </div>
            <div class="app_mainItem">
                <div class="app_mainItem_label">巡检人<span>*</span></div>
                <div class="app_mainItem_inp" @click="people1Show = true">
                    <div :style="{color:form.people == '' ?'#D1D1D1':'#000'}">{{ form.people || '请选择'
                        }}<span class="iconfont icon-arrow-right-bold"></span></div>
                </div>
            </div>
            <div class="app_mainItem">
                <div class="app_mainItem_label">开始时间<span>*</span></div>
                <div class="app_mainItem_inp" @click="isVisibleStart = true">
                    <div :style="{color:form.startTime == '' ?'#D1D1D1':'#000'}">{{ form.startTime || '请选择'
                        }}<span class="iconfont icon-arrow-right-bold"></span></div>
                </div>
            </div>
            <div class="app_mainItem">
                <div class="app_mainItem_label">截止时间<span>*</span></div>
                <div class="app_mainItem_inp" @click="isVisibleEnd = true">
                    <div :style="{color:form.endTime == '' ?'#D1D1D1':'#000'}">{{ form.endTime || '请选择'
                        }}<span class="iconfont icon-arrow-right-bold"></span></div>
                </div>
            </div>

            <div class="app_mainItem2">
                <div class="app_mainItem_label">备注说明</div>
                <div class="app_mainItem_inp">
                    <nut-textbox v-model="form.note" :max-num="100"></nut-textbox>
                </div>
            </div>
            <nut-button block>确定</nut-button>
        </div>
        <!-- 巡检范围弹窗 -->
        <nut-popup v-model="rangeShow" position="bottom" :style="{ height: '100vh' }">
            <div class="popupTitle">
                <div class="left" @click="rangeShow = false">
                    <span class="iconfont icon-close-bold"></span>
                </div>
                <div class="title">片区选择</div>
            </div>
            <div class="popup_main">
                <div class="popup_mainList">
                    <div class="popup_mainListItem str active">长沙</div>
                    <div class="popup_mainListItem str">株洲</div>
                    <div class="popup_mainListItem str">湘潭</div>
                    <div class="popup_mainListItem str">岳阳</div>
                </div>
                <div class="popup_mainList">
                    <div class="popup_mainListItem active">全部</div>
                    <div class="popup_mainListItem str">芙蓉区</div>
                    <div class="popup_mainListItem str">天心区</div>
                    <div class="popup_mainListItem str">岳麓区</div>
                    <div class="popup_mainListItem str">开福区</div>
                    <div class="popup_mainListItem str">雨花区</div>
                    <div class="popup_mainListItem str">望城区</div>
                    <div class="popup_mainListItem str">长沙县</div>
                    <div class="popup_mainListItem str">宁乡市</div>
                    <div class="popup_mainListItem str">浏阳市</div>
                </div>
                <div class="popup_mainList">
                    <div class="popup_mainListItem active">全部</div>
                    <div class="popup_mainListItem str">新开铺街道</div>
                    <div class="popup_mainListItem str">城南路街道</div>
                    <div class="popup_mainListItem str">文源街道</div>
                    <div class="popup_mainListItem str">金盆岭街道</div>
                    <div class="popup_mainListItem str">先锋街道</div>
                    <div class="popup_mainListItem str">坡子街街道</div>
                    <div class="popup_mainListItem str">青园街道</div>
                    <div class="popup_mainListItem str">桂花坪街道</div>
                    <div class="popup_mainListItem str">暮云街道</div>
                    <div class="popup_mainListItem str">黑石铺街道</div>
                    <div class="popup_mainListItem str">大坨铺街道</div>
                    <div class="popup_mainListItem str">南拖街道</div>
                    <div class="popup_mainListItem str">金盆岭街道</div>
                    <div class="popup_mainListItem str">先锋街道</div>
                </div>
            </div>
            <div class="popupBtn">
                <div class="exit" @click="rangeShow = false">取消</div>
                <div class="submit" @click="rangeShow = false">确定</div>
            </div>
        </nut-popup>
        <!-- 巡检内容弹窗 -->
        <nut-popup v-model="contentShow" position="bottom" round :style="{ height: '40%' }">
            <div class="popupTitle">
                <div class="left"></div>
                <div class="title">巡检内容</div>
            </div>
            <div class="popupMain">
                <div class="popupMainItem" v-for="(item, index) in contentList" :key="index"
                    @click="selectType(item,1)">
                    {{item.name}}</div>
            </div>
        </nut-popup>
        <!-- 巡检人弹窗 1 -->
        <nut-popup v-model="people1Show" position="bottom" round :style="{ height: '20vh' }">
            <div class="popupTitle">
                <div class="title">巡检人</div>
            </div>
            <div class="popupMain" style="height: calc(20vh - 50px)!important;">
                <div class="popupMainList">
                    <div class="popupMainListItem">
                        <div>负责人</div>
                        <nut-radio v-model="radioVal" :label="'负责人'"></nut-radio>
                    </div>
                    <div class="popupMainListItem">
                        <div>其他</div>
                        <nut-radio v-model="radioVal" :label="'其他'"></nut-radio>
                    </div>
                </div>
                <div class="app_mainItem" v-if="radioVal == '负责人'">
                    <div class="app_mainItem_label">巡检人<span>*</span></div>
                    <div class="app_mainItem_inp">
                        <div :style="{color:form.people == '' ?'#D1D1D1':'#000'}">{{ form.people || '请选择'
                            }}<span class="iconfont icon-arrow-right-bold"></span></div>
                    </div>
                </div>
                <div class="app_mainItem" v-if="radioVal == '其他'">
                    <div class="app_mainItem_label">巡检人<span>*</span></div>
                    <div class="app_mainItem_inp" @click="people2Show = true, people1Show = false">
                        <div :style="{color:form.people == '' ?'#D1D1D1':'#000'}">{{ form.people || '请选择'
                            }}<span class="iconfont icon-arrow-right-bold"></span></div>
                    </div>
                </div>
                <!-- <div class="popupMain"></div> -->
            </div>
        </nut-popup>
        <!-- 巡检人弹窗 2 -->
        <nut-popup v-model="people2Show" position="bottom" round :style="{ height: '40%' }">
            <div class="popupTitle">
                <div class="left" @click="people1Show = true, people2Show = false">
                    <span class="iconfont icon-close-bold"></span>
                </div>
                <div class="title">选择人员</div>
            </div>
            <div class="popupMain">
                <div class="popupMainItem" v-for="(item, index) in peopleList" :key="index" @click="selectType(item,2)">
                    {{item.name}}</div>
            </div>
        </nut-popup>
        <!-- 开始时间选择 -->
        <nut-datepicker :is-visible="isVisibleStart" type="date" title="请选择日期" :is-show-chinese="false"
            @close="switchPickerStart('isVisibleStart')" @choose="setChooseValueStart">
        </nut-datepicker>
        <!-- 截止时间选择 -->
        <nut-datepicker :is-visible="isVisibleEnd" type="date" title="请选择日期" :is-show-chinese="false"
            @close="switchPickerEnd('isVisibleEnd')" @choose="setChooseValueEnd">
        </nut-datepicker>
    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                radioVal: '',
                isVisibleStart: false,
                isVisibleEnd: false,
                rangeShow: false,
                contentShow: false,
                people1Show: false,
                people2Show: false,
                peopleList: [
                    { id: 1, name: '张三1111' },
                    { id: 2, name: '张三2222' },
                    { id: 3, name: '张三3333' },
                    { id: 4, name: '张三4444' },
                    { id: 5, name: '张三5555' },
                ],
                contentList: [
                    { id: 1, name: '巡检内容111' },
                    { id: 2, name: '巡检内容222' },
                    { id: 3, name: '巡检内容333' },
                    { id: 4, name: '巡检内容444' },
                    { id: 5, name: '巡检内容555' },
                    { id: 6, name: '巡检内容666' },
                ],
                form: {
                    taskName: '',
                    range: '',
                    content: '',
                    people: '',
                    startTime: '',
                    endTime: '',
                    note: ''
                }
            },
            mounted() { },
            watch: {
                radioVal(val) {
                    if (val == '负责人') {
                        this.form.people = '负责人1111'
                        this.people1Show = false
                    } else {
                        this.form.people = ''
                    }
                }
            },
            methods: {
                back() {
                    window.history.go(-1);
                },
                switchPickerStart(param) {
                    this[`${param}`] = !this[`${param}`];
                },
                setChooseValueStart(param) {
                    this.form.startTime = param[3];
                },
                switchPickerEnd(param) {
                    this[`${param}`] = !this[`${param}`];
                },
                setChooseValueEnd(param) {
                    this.form.endTime = param[3];
                },
                selectType(data, val) {
                    if (val == 1) {
                        this.form.content = data.name
                        this.contentShow = false
                    } else if (val == 2) {
                        this.form.people = data.name
                        this.people2Show = false
                    }
                },
            }
        })
    </script>
</body>

</html>